home *** CD-ROM | disk | FTP | other *** search
- //-----------------------------------------------
- // TwoPaintHandlers.cs ⌐ 2001 by Charles Petzold
- //-----------------------------------------------
- using System;
- using System.Drawing;
- using System.Windows.Forms;
-
- class TwoPaintHandlers
- {
- public static void Main()
- {
- Form form = new Form();
- form.Text = "Dos controladores Paint";
- form.BackColor = Color.White;
- form.Paint += new PaintEventHandler(PaintHandler1);
- form.Paint += new PaintEventHandler(PaintHandler2);
-
- Application.Run(form);
- }
- static void PaintHandler1(object objSender, PaintEventArgs pea)
- {
- Form form = (Form)objSender;
- Graphics grfx = pea.Graphics;
-
- grfx.DrawString("Primer controlador de eventos Paint", form.Font,
- Brushes.Black, 0, 0);
- }
- static void PaintHandler2(object objSender, PaintEventArgs pea)
- {
- Form form = (Form)objSender;
- Graphics grfx = pea.Graphics;
-
- grfx.DrawString("Segundo controlador de eventos Paint", form.Font,
- Brushes.Black, 0, 100);
- }
- }
-